import Vue from 'vue'
import VueRouter from "vue-router"

import Layout from '@/views/layout'
import Article from '@/views/article'
import Collect from '@/views/collect'
import Like from '@/views/like'
import User from '@/views/user'
import ArticleDetail from '@/views/article-detail'


Vue.use(VueRouter)

const router = new VueRouter({

  routes: [
    {
      path:'/',
      redirect: '/layout',
    },
    // 配置一级路由
    {
      name:'Layout',
      path:'/layout',
      component: Layout,
      // 配置二级路由
      children:[
        {
          name:'Article',
          path:'/article',
          component: Article,
        },
        {
          name:'Collect',
          path:'/collect',
          component: Collect,
        },
        {
          name:'Like',
          path:'/like',
          component: Like,
        },
        {
          name:'User',
          path:'/user',
          component: User,
        },
      ]
    },
    {
      name:'ArticleDetail',
      path:'/detail/:id',
      component: ArticleDetail,
    },
  ]
})

export default router